home *** CD-ROM | disk | FTP | other *** search
- Path: opalo.etsiig.uniovi.es!soneto!u1436956
- Newsgroups: comp.lang.c
- Subject: Problem in my INT 16H!!!
- Message-ID: <1996Jan11.112500.5877@opalo.etsiig.uniovi.es>
- From: u1436956@soneto.etsiig.uniovi.es (FERNANDEZ CASTA#O ; JOSE IGNACIO)
- Date: 11 Jan 96 11:24:59 +0100
- Nntp-Posting-Host: soneto.etsiig.uniovi.es
- X-Newsreader: TIN [version 1.2 PL2]
-
-
-
- WHAT IS THE PROBLEM???
-
-
- #include <stdio.h>
- #include <dos.h>
- #include <conio.h>
- #include <stdlib.h>
-
- #define INTR 0X16 // 22
-
- #ifdef __cplusplus
- #define __CPPARGS ...
- #else
- #define __CPPARGS
- #endif
-
- #include <stdio.h>
- #include <dos.h>
- #include <conio.h>
- #include <stdlib.h>
-
- #define INTR 0X16 // 22
-
- #ifdef __cplusplus
- #define __CPPARGS ...
- #else
- #define __CPPARGS
- #endif
-
- void interrupt far ( *old_16h)(__CPPARGS);
-
- void interrupt far new_16h(__CPPARGS)
- {
- disable();
- unsigned far *start=(unsigned far *)0x00400080;
- unsigned far *end=(unsigned far *)0x00400082;
- unsigned far *head=(unsigned far *)0x0040001A;
- unsigned far *tail=(unsigned far *)0x0040001C;
-
- // ONLY FUNCTION 0 and 10H
- asm {
- cmp ah,0
- je captura
- cmp ah,10h
- je captura
- }
-
- /* llamamos a la vieja rutina */
- enable();
- old_16h();
- return;
-
- // tratamiento de la función capturada
- captura:
-
- // WHILE NO PRESSET NEVER KEY
- while( *tail == *head );
-
- char far *base=(char far *)0x00400000;
- char ascci=*( base + *head );
- char scanCode=*( base+1 + *head );
- unsigned _out=ascci*256+scanCode;
-
- // Incrementamos la cabeza
- *head+=sizeof(unsigned);
-
- // Observamos si llegamos al final del buffer
- if( *head >= *end)
- *head = *start;
-
- asm {
- mov ax,_out
- }
- enable();
- }
-
- main()
- {
- /* salvamos el vector de interrupción */
- old_16h = getvect(INTR);
-
- /* instalamos la nueva interrupción */
- setvect(INTR, new_16h);
-
- /* cargamos el command.com */
- // system("\command.com"); // PROBLEM
- // OR
- // delay(6000); // NO PROBLEM; VERY WELL
- // OR
- char s[80]; // PROBLEM
- gets(s);
- printf("%s",s);
-
- printf("END 16H");
-
- /* restauramos el vector 16h a su valor inicial */
- setvect(INTR, old_16h);
-
- return 0;
- }
-
-
-
-
-
-
-
- - NATXO -
-
-
-
-
-